<template>
  <div>
    <pulldown header="基本信息">
      <div slot="content">
        <a-descriptions bordered :column="4">
          <a-descriptions-item v-for="(item,index) of forList" :key="index" :label="item.name" :span="item.span">
            {{ result[item.key] }}
          </a-descriptions-item>
        </a-descriptions>
      </div>
    </pulldown>
    <pulldown header="入职信息">
      <div slot="content">
        <a-descriptions bordered :column="4">
          <a-descriptions-item v-for="(item,index) of  forList1" :key="index" :label="item.name" :span="item.span">
            {{ result[item.key] }}
          </a-descriptions-item>
        </a-descriptions>
      </div>
    </pulldown>
    <pulldown header="教育背景">
      <div slot="content">
        <z-table
          ref="table"
          rowKey="id"
          :showAlert="false"
          :showSelection="false"
          :loading="loading"
          :columns="columns"
          :dataSource="pageData"
          @selectedRow="onSelectedRow"
          @change="onTableChange"
        >
        </z-table>
      </div>
    </pulldown>
    <pulldown header="工作经历">
      <div slot="content">
        <z-table
          ref="table"
          rowKey="id"
          :showAlert="false"
          :showSelection="false"
          :loading="loading"
          :columns="columns"
          :dataSource="pageData"
          @selectedRow="onSelectedRow"
          @change="onTableChange"
        >
        </z-table>
      </div>
    </pulldown>
<!--    {{$filterDictTextByCache('process_approval_type', 1)}}-->
  </div>
</template>

<script>
import pulldown from '../../../modules/pulldown'
import {seeAdministrators} from "@api/sjsk/specialist";
import {Families} from "@api/sjsk/archives";
export default {
  name: "individual",
  components:{ pulldown },
  props:['id'],
  data(){
    return {
      result:undefined,
      forList:[
        {name:'填表日期',key:'fillformTime',val:'2022.07.14'},
        {name:'姓名',key:'personnelName',val:'张三'},
        {name:'性别',key:'personnelSex',val:'女'},
        {name:'出生年月',key:'birthday',val:'2022.07.14'},
        {name:'体重（kg）',key:'weight',val:'61KG'},
        {name:'身高（cm）',key:'height',val:'171cm'},
        {name:'籍贯',key:'nativePlace',val:'海南海口'},
        {name:'血型',key:'bloodType',val:'O型'},
        {name:'民族',key:'nation',val:'汉族'},
        {name:'政治面貌',key:'politicalOutlook',val:'共青团员'},
        {name:'健康状态',key:'healthStatus',val:'健康'},
        {name:'婚姻状态',key:'maritalStatus',val:'未婚'},
        {name:'文化程度',key:'degreeEducation',val:'本科'},
        {name:'毕业院校',key:'graduationSchool',val:'中国医科大学'},
        {name:'专业',key:'major',val:'2022.07.14'},
        {name:'毕业时间',key:'graduationTime',val:'2022.07.14'},
        {name:'联系电话',key:'phone',val:'18920394829'},
        {name:'邮箱',key:'email',val:'728374829@qq.com'},
        {name:'紧急联系人',key:'emergencyName',val:'李牧'},
        {name:'联系电话',key:'emergencyPhone',val:'18728394827'},
      ],
      forList1:[
        {name:'入职时间',key:'entryTime',val:'2022.07.14'},
        {name:'部门',key:'departName',val:'禁毒部门'},
        {name:'直属上级',key:'date',val:'林敏'},
        {name:'职务',key:'duties',val:'禁毒主任'},
        {name:'禁毒社区',key:'region',val:'海南省三亚市海棠区金宇街道办禁毒办',span:3},

      ],
      loading: false,
      columns: [
        // {
        //   title: '序号',
        //   dataIndex: 'order',
        //   width: 60,
        //   align: 'center',
        //   customRender: (text, record, index) => {
        //     return `${(this.pageFilter.pageNo - 1) * this.pageFilter.pageSize + (index + 1)}` //序号分页后连续
        //   }
        // },
        {
          title: '性别',
          dataIndex: 'incidentName',
          width: 60,
          align: 'center',
          customRender: text => {
            return <j-ellipsis value={text} length={14} />
          }
        },
        {
          title: '身份证号',
          dataIndex: 'incidentCode',
          width: 110,
          align: 'left',
          customRender: text => {
            return <j-ellipsis value={text} length={20} />
          }
        },
        {
          title: '人员类型',
          dataIndex: 'name',
          width: 80,
          align: 'center'
        },
        {
          title: '联系电话',
          dataIndex: 'labelAddress',
          width: 100,
          align: 'center',
          customRender: text => {
            return <j-ellipsis value={text} length={14} />
          }
        },
        {
          title: '管辖地区',
          dataIndex: 'loginStatus',
          width: 80,
          align: 'center'
        },
        {
          title: '入库时间',
          dataIndex: 'labelName',
          width: 100,
          align: 'center',
          customRender: text => {
            return <j-ellipsis value={text} length={14} />
          }
        },
        // {
        //   title: '操作',
        //   width: 120,
        //   align: 'center',
        //   dataIndex: 'action',
        //   scopedSlots: { customRender: 'action' },
        // }
      ],
      pageFilter: {
        pageNo: 1,
        pageSize: 10
      },
      pageData:[
        {
          incidentName:1,
          type:'1'
        },
        {
          incidentName:2,
          type:'2'
        },
        {
          incidentName:3,
          type:'3'
        }
      ]
    }
  },
  mounted() {
    // this.refreshTable()
  },
  methods:{
    onSelectedRow(keys) {
      this.selectKeys = keys
      this.isDisabled = keys.length > 0 ? false : true
    },
    onTableChange(pagination, pageFilter, sorter) {
      let keyMap = { currentPage: 'pageNo' }
      let paginations = Object.keys(pagination).reduce((newData, key) => {
        let newKey = keyMap[key] || key
        newData[newKey] = pagination[key]
        return newData
      }, {})
      this.pageFilter = Object.assign({}, this.pageFilter, paginations)
      this.refreshTable()
    },
    refreshTable(id){
      console.log(id)
      seeAdministrators(id).then(ser => {
        if(ser.success){
          this.result = ser.result.administratorsDto
          console.log(ser)
          console.log(6)
        }
      }).catch(err => {

      })
    },
  }
}
</script>

<style scoped>

</style>